package com.design_patterns.iterator.v4;

/**
 * @author: 李德才
 * @description:
 * @create: 2020-09-01 20:26
 **/
public class Main {


    public static void main(String[] args) {
        LinkedListIterator();
    }

    public static void LinkedListIterator() {
        Collection_<Integer> linkedList_ = new LinkedList_<>();
        for (int i = 0; i < 10; i++) {
            linkedList_.add(i);
        }
        Iterator_<Integer> iterator = linkedList_.iterator();
        while (iterator.hasNext()) {
            System.err.println(iterator.next());
        }
}

    public static void ArrayListIterator() {
        Collection_<Integer> arrayList_ = new ArrayList_<>();
        for (int i = 0; i < 10; i++) {
            arrayList_.add(i);
        }
        Iterator_<Integer> iterator = arrayList_.iterator();
        while (iterator.hasNext()) {
            System.err.println(iterator.next());
        }
    }
}
